<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>

    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>


    <title>后台管理</title>
    <meta name="keywords" content=""/>
    <meta name="description" content=""/>

    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">


    <!-- import Vue before Element -->
    <script src="https://unpkg.com/vue/dist/vue.js"></script>
    <!-- import JavaScript -->
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>
    <style>
        html, body {
            margin: 0;
            padding: 0;
        }

        html {
            height: 100%;
        }

        .con {
            padding: 10px;
        }

        #form {
            width: 100%;
            height: 100;
            background-color: rgba(0, 0, 0, .3);
            position: fixed;
            left: 0;
            top: 0;
            display: none;
            z-index: 99;
        }

        #form form {
            width: 1000px;
            height: 1500px;
            margin: auto;
            padding: 5px 25px;
            border-radius: 10px;
            background-color: #fff;
        }

        .avatar-uploader .el-upload {
            border: 1px dashed #d9d9d9;
            border-radius: 6px;
            cursor: pointer;
            position: relative;
            overflow: hidden;
        }

        .avatar-uploader .el-upload:hover {
            border-color: #409EFF;
        }

        .avatar-uploader-icon {
            font-size: 28px;
            color: #8c939d;
            width: 178px;
            height: 178px;
            line-height: 178px;
            text-align: center;
        }

        .avatar {
            width: 178px;
            height: 178px;
            display: block;
        }

        .topCon {
            height: 100px;
            line-height: 100px;
            padding: 0 20px;
            font-size: 32px;
            font-weight: 600;
            border-bottom: 1px solid #333;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .conItem {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
        }

        .conLeft {
            width: 200px;
            height: calc(100% - 200px);
        }

        .conRight {
            flex-grow: 1;
        }
    </style>

</head>

<body>
<div id="indexApp" v-loading="loading">
    <div class="topCon">
        <div>学生评语管理系统</div>
        <div @click="loginOut();" style="font-size: 14px;cursor: pointer;">退出</div>
    </div>
    <div class="conItem">
        <div class="conLeft">
            <el-menu
                    :default-active="activeIndex"
                    class="el-menu-vertical-demo"
                    @select="handleSelect"
                    background-color="#545c64"
                    text-color="#fff"
                    active-text-color="#ffd04b"
                    style="height: 100vh;">
                <el-menu-item index="1">学生管理</el-menu-item>
                <el-menu-item index="2">公告管理</el-menu-item>
                <el-menu-item index="3">学生评语管理</el-menu-item>
                <el-menu-item index="9">评语模板管理</el-menu-item>
                <el-menu-item index="10">假期通知册</el-menu-item>
                <el-menu-item index="11">作业设置</el-menu-item>
                <el-menu-item index="6">系统用户管理</el-menu-item>
            </el-menu>
        </div>
        <div class="conRight">

            <div v-show="activeIndex=='1'" class="con">
                <el-button @click="addAppUser()">新增学生</el-button>
                <el-table
                        :data="appUserData"
                        border
                        style="width: 100%">
                    <el-table-column
                            prop="name"
                            label="学生姓名">
                    </el-table-column>
                    <el-table-column
                            prop="student_id"
                            label="学号">
                    </el-table-column>
                    <el-table-column
                            prop="a_id"
                            label="密码">
                    </el-table-column>
                    <el-table-column
                            prop="grade"
                            label="年级">
                    </el-table-column>
                    <el-table-column
                            prop="s_class"
                            label="班级">
                    </el-table-column>
                    <el-table-column
                            prop="s_de"
                            label="德">
                    </el-table-column>
                    <el-table-column
                            prop="s_zhi"
                            label="智">
                    </el-table-column>
                    <el-table-column
                            prop="s_ti"
                            label="体">
                    </el-table-column>
                    <el-table-column
                            prop="s_mei"
                            label="美">
                    </el-table-column>
                    <el-table-column
                            prop="s_nao"
                            label="劳">
                    </el-table-column>
                    <el-table-column
                            prop="s_content"
                            label="老师评语">
                    </el-table-column>
                    <el-table-column
                            fixed="right"
                            label="操作"
                            width="100">
                        <template slot-scope="scope" width="100">
                            <el-button ref="editAppUser" type="text" size="small" @click="editAppUser(scope.row)">编辑
                            </el-button>
                            <el-button ref="delAppUser" type="text" size="small" @click="delAppUser(scope.row)">删除
                            </el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <div style="text-align:right;">
                    <el-pagination
                            @current-change="handleAppUserCurrentChange"
                            :current-page="pageAppUserInit.currentPage"
                            :page-size="10"
                            layout="total, prev, pager, next, jumper"
                            :total="pageAppUserInit.totalResult">
                    </el-pagination>
                </div>
            </div><!--新增APP用户-->
            <el-dialog
                    :title="appUserTitle"
                    :visible.sync="appUserFlag"
                    width="50%">
                <el-form ref="appUserForm" :model="appUserForm" label-width="80px">
                    <el-form-item label="姓名">
                        <el-input v-model="appUserForm.name"></el-input>
                    </el-form-item>

                    <el-form-item label="学号">
                        <el-input v-model="appUserForm.student_id" placeholder="注意学号不能重复"></el-input>
                    </el-form-item>

                    <el-form-item label="密码">
                        <el-input v-model="appUserForm.a_id"></el-input>
                    </el-form-item>
                    <el-form-item label="年级">
                        <el-input v-model="appUserForm.grade"></el-input>
                    </el-form-item>
                    <el-form-item label="班级">
                        <el-input v-model="appUserForm.s_class"></el-input>
                    </el-form-item>

                    <el-form-item label="德">
                        <el-input v-model="appUserForm.s_de"></el-input>
                    </el-form-item>
                    <el-form-item label="智">
                        <el-input v-model="appUserForm.s_zhi"></el-input>
                    </el-form-item>

                    <el-form-item label="体">
                        <el-input v-model="appUserForm.s_ti"></el-input>
                    </el-form-item>
                    <el-form-item label="美">
                        <el-input v-model="appUserForm.s_mei"></el-input>
                    </el-form-item>
                    <el-form-item label="劳">
                        <el-input v-model="appUserForm.s_nao"></el-input>
                    </el-form-item>
                    <el-form-item label="老师评语">
                        <el-input type="textarea" v-model="appUserForm.s_content"></el-input>
                    </el-form-item>


                    <el-form-item>
                        <el-button type="primary" @click="onAppUserSubmit">立即提交</el-button>
                    </el-form-item>
                </el-form>
            </el-dialog>
            <div v-show="activeIndex=='2'" class="con">
                <el-button @click="addChainStore()">新增公告</el-button>
                <el-table
                        :data="chainStoreData"
                        border
                        style="width: 100%">
                    <el-table-column
                            prop="title"
                            label="公告标题">
                    </el-table-column>
                    <el-table-column
                            prop="content"
                            label="公告详情">
                    </el-table-column>
                    <el-table-column
                            label="图片">
                        <template slot-scope="scope" width="100">
                            <img :src="scope.row.url" style="width: 120px;"/>
                        </template>
                    </el-table-column>
                    <el-table-column
                            fixed="right"
                            label="操作"
                            width="100">
                        <template slot-scope="scope" width="100">
                            <el-button ref="editChainStore" type="text" size="small" @click="editChainStore(scope.row)">
                                编辑
                            </el-button>
                            <el-button ref="delChainStore" type="text" size="small" @click="delChainStore(scope.row)">
                                删除
                            </el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <div style="text-align:right;">
                    <el-pagination
                            @current-change="handleChainStoreCurrentChange"
                            :current-page="pageChainStoreInit.currentPage"
                            :page-size="10"
                            layout="total, prev, pager, next, jumper"
                            :total="pageChainStoreInit.totalResult">
                    </el-pagination>
                </div>
            </div><!--新增连锁店-->
            <el-dialog
                    :title="chainStoreTitle"
                    :visible.sync="chainStoreFlag"
                    width="50%">
                <el-form ref="chainStoreForm" :model="chainStoreForm" label-width="80px">

                    <el-form-item label="公告标题">
                        <el-input v-model="chainStoreForm.title"></el-input>
                    </el-form-item>
                    <el-form-item label="公告详情">
                        <el-input type="textarea" v-model="chainStoreForm.content"></el-input>
                    </el-form-item>

                    <el-form-item label="上传图片">

                        <el-upload
                                class="avatar-uploader"
                                :action=`${basePathUpdate}`
                                :show-file-list="false"
                                :on-success="handleAvatarSuccess">
                            <img v-if="chainStoreForm.url!=''" :src="chainStoreForm.url" class="avatar"
                                 style="width: 300px;"/>
                            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                        </el-upload>
                    </el-form-item>

                    <el-form-item>
                        <el-button type="primary" @click="onChainStoreSubmit">立即提交</el-button>
                    </el-form-item>
                </el-form>
            </el-dialog>
            <div v-show="activeIndex=='3'" class="con">
                <el-button size="small" @click="addOperationFlow()">新增学生评语</el-button>
                <el-button size="small" @click="generateComment()">自动生成评语</el-button>
                <el-table
                        :data="operationFlowData"
                        border
                        style="width: 100%">
                    <el-table-column
                            label="学生">
                        <template slot-scope="scope">
                            <span>{{returnUser(scope.row.a_id)}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column
                            prop="c_class"
                            label="科目">
                    </el-table-column>

                    <el-table-column
                            label="老师">
                        <template slot-scope="scope">
                            <span>{{returnSysUser(scope.row.s_id)}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column
                            label="评语等级">
                        <template slot-scope="scope">
                            <span v-if="scope.row.c_lv==1">优</span>
                            <span v-else-if="scope.row.c_lv==2">良</span>
                            <span v-else-if="scope.row.c_lv==3">中</span>
                            <span v-else>差</span>
                        </template>
                    </el-table-column>
                    <el-table-column
                            prop="c_content"
                            label="评语内容">
                    </el-table-column>
                    <el-table-column
                            fixed="right"
                            label="操作"
                            width="100">
                        <template slot-scope="scope" width="100">
                            <el-button ref="editPos" type="text" size="small" @click="editOperationFlow(scope.row)">编辑
                            </el-button>
                            <el-button ref="delPos" type="text" size="small" @click="delOperationFlow(scope.row)">删除
                            </el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <div style="text-align:right;">
                    <el-pagination
                            @current-change="handleOperationFlowCurrentChange"
                            :current-page="pageOperationFlowInit.currentPage"
                            :page-size="10"
                            layout="total, prev, pager, next, jumper"
                            :total="pageOperationFlowInit.totalResult">
                    </el-pagination>
                </div>
            </div><!--新增营业流水-->
            <el-dialog
                    :title="operationFlowTitle"
                    :visible.sync="operationFlowFlag"
                    width="50%">
                <el-form ref="operationFlowForm" :model="operationFlowForm" label-width="80px">


                    <el-form-item label="学生">
                        <el-select v-model="operationFlowForm.a_id" filterable placeholder="请选择">
                            <el-option
                                    v-for="item in courseOptions"
                                    :key="item.id"
                                    :label="item.name"
                                    :value="item.id">
                            </el-option>
                        </el-select>
                    </el-form-item>

                    <el-form-item label="科目">
                        <el-input v-model="operationFlowForm.c_class"></el-input>
                    </el-form-item>
                    <el-form-item label="评语等级">
                        <el-select v-model="operationFlowForm.c_lv" placeholder="请选择">
                            <el-option label="优" :value="1"></el-option>
                            <el-option label="良" :value="2"></el-option>
                            <el-option label="中" :value="3"></el-option>
                            <el-option label="差" :value="4"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="评语">
                        <el-input type="textarea" v-model="operationFlowForm.c_content"></el-input>
                    </el-form-item>

                    <el-form-item>
                        <el-button type="primary" @click="onOperationFlowSubmit">立即提交</el-button>
                    </el-form-item>
                </el-form>
            </el-dialog>
            <div v-show="activeIndex=='4'" class="con">
                <el-table
                        :data="posData"
                        border
                        style="width: 100%">
                    <el-table-column
                            prop="competition_name"
                            label="公告名称">
                    </el-table-column>
                    <el-table-column
                            prop="student_course_name"
                            label="学生">
                    </el-table-column>
                    <el-table-column
                            prop="web_url"
                            label="网页地址">
                    </el-table-column>
                    <el-table-column
                            prop="details"
                            label="作品说明">
                    </el-table-column>
                    <el-table-column
                            prop="score"
                            label="评委打分">
                    </el-table-column>
                    <el-table-column
                            label="是否通过">
                        <template slot-scope="scope">
                            <span v-if="scope.row.is_pass==1">通过</span>
                            <span v-else-if="scope.row.is_pass==2">未通过</span>
                            <span v-else>待审核</span>
                        </template>
                    </el-table-column>
                    <el-table-column
                            fixed="right"
                            label="操作"
                            width="100">
                        <template slot-scope="scope" width="100">
                            <!--                    <el-button ref="editPos" type="text" size="small" @click="editPos(scope.row)">评委打分</el-button>-->
                        </template>
                    </el-table-column>
                </el-table>
                <div style="text-align:right;">
                    <el-pagination
                            @current-change="handlePosCurrentChange"
                            :current-page="pagePosInit.currentPage"
                            :page-size="10"
                            layout="total, prev, pager, next, jumper"
                            :total="pagePosInit.totalResult">
                    </el-pagination>
                </div>
            </div><!--新增商户-->
            <el-dialog
                    title="评委打分"
                    :visible.sync="posFlag"
                    width="50%">
                <el-form ref="posForm" :model="posForm" label-width="80px">
                    <el-form-item label="学生评语视频">
                        <video :src="posForm.url" controls="controls" style="width: 300px;"></video>
                    </el-form-item>

                    <el-form-item label="答题分数">
                        <el-input type="number" v-model="posForm.score"></el-input>
                    </el-form-item>

                    <el-form-item label="是否通过">
                        <el-select v-model="posForm.is_pass" placeholder="请选择">
                            <el-option label="待阅卷" :value="0"></el-option>
                            <el-option label="通过" :value="1"></el-option>
                            <el-option label="未通过" :value="2"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" @click="onPosSubmit">立即提交</el-button>
                    </el-form-item>
                </el-form>
            </el-dialog>
            <div v-show="activeIndex=='5'" class="con">
                <el-button @click="addRole()">新增角色</el-button>
                <el-table
                        :data="roleData"
                        border
                        style="width: 100%">
                    <el-table-column
                            prop="id"
                            label="系统ID">
                    </el-table-column>
                    <el-table-column
                            prop="role_name"
                            label="角色名(店主(ordinary)、商户(admin))">
                    </el-table-column>
                    <el-table-column
                            prop="authority"
                            label="权限">
                    </el-table-column>
                    <el-table-column
                            prop="create_time"
                            label="创建时间">
                    </el-table-column>
                    <el-table-column
                            prop="update_time"
                            label="更新时间">
                    </el-table-column>
                    <el-table-column
                            fixed="right"
                            label="操作"
                            width="100">
                        <template slot-scope="scope" width="100">
                            <el-button ref="editRole" type="text" size="small" @click="editRole(scope.row)">编辑
                            </el-button>
                            <el-button ref="delRole" type="text" size="small" @click="delRole(scope.row)">删除</el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <div style="text-align:right;">
                    <el-pagination
                            @current-change="handleRoleCurrentChange"
                            :current-page="pageRoleInit.currentPage"
                            :page-size="10"
                            layout="total, prev, pager, next, jumper"
                            :total="pageRoleInit.totalResult">
                    </el-pagination>
                </div>
            </div><!--新增角色-->
            <el-dialog
                    title="角色操作"
                    :visible.sync="roleFlag"
                    width="50%">
                <el-form ref="roleForm" :model="roleForm" label-width="80px">

                    <el-form-item label="系统ID">
                        <el-input v-model="roleForm.id"></el-input>
                    </el-form-item>

                    <el-form-item label="角色名(店主(ordinary)、商户(admin))">
                        <el-input v-model="roleForm.role_name"></el-input>
                    </el-form-item>

                    <el-form-item label="权限">
                        <el-input v-model="roleForm.authority"></el-input>
                    </el-form-item>

                    <el-form-item label="创建时间">
                        <el-input v-model="roleForm.create_time"></el-input>
                    </el-form-item>

                    <el-form-item label="更新时间">
                        <el-input v-model="roleForm.update_time"></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" @click="onRoleSubmit">立即提交</el-button>
                    </el-form-item>
                </el-form>
            </el-dialog>
            <div v-show="activeIndex=='6'" class="con">
                <el-button @click="addSystemUser()">新增用户</el-button>
                <el-table
                        :data="systemUserData"
                        border
                        style="width: 100%">
                    <el-table-column
                            prop="USERNAME"
                            label="用户名">
                    </el-table-column>
                    <el-table-column
                            prop="PASSWORD"
                            label="密码">
                    </el-table-column>
                    <el-table-column
                            prop="NAME"
                            label="姓名">
                    </el-table-column>
                    <el-table-column
                            label="角色">
                        <template slot-scope="scope">
                            <span v-if="scope.row.role_id==2">老师</span>
                            <span v-else-if="scope.row.role_id==3">管理员</span>
                        </template>
                    </el-table-column>
                    <el-table-column
                            prop="signature"
                            label="手机号码">
                    </el-table-column>
                    <el-table-column
                            fixed="right"
                            label="操作"
                            width="100">
                        <template slot-scope="scope" width="100">
                            <el-button ref="editSystemUser" type="text" size="small" @click="editSystemUser(scope.row)">
                                编辑
                            </el-button>
                            <el-button ref="delSystemUser" type="text" size="small" @click="delSystemUser(scope.row)">
                                删除
                            </el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <div style="text-align:right;">
                    <el-pagination
                            @current-change="handleSystemUserCurrentChange"
                            :current-page="pageSystemUserInit.currentPage"
                            :page-size="10"
                            layout="total, prev, pager, next, jumper"
                            :total="pageSystemUserInit.totalResult">
                    </el-pagination>
                </div>
            </div><!--新增系统用户-->
            <el-dialog
                    :title="systemUserTitle"
                    :visible.sync="systemUserFlag"
                    width="50%">
                <el-form ref="systemUserForm" :model="systemUserForm" label-width="80px">
                    <el-form-item label="用户名">
                        <el-input v-model="systemUserForm.USERNAME"></el-input>
                    </el-form-item>

                    <el-form-item label="密码">
                        <el-input v-model="systemUserForm.PASSWORD"></el-input>
                    </el-form-item>

                    <el-form-item label="姓名">
                        <el-input v-model="systemUserForm.NAME"></el-input>
                    </el-form-item>
                    <el-form-item label="角色">
                        <el-select v-model="systemUserForm.role_id" placeholder="请选择">
                            <el-option label="老师" :value="2"></el-option>
                            <el-option label="管理员" :value="3"></el-option>
                        </el-select>
                    </el-form-item>

                    <el-form-item label="手机号码">
                        <el-input v-model="systemUserForm.signature"></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" @click="onSystemUserSubmit">立即提交</el-button>
                    </el-form-item>
                </el-form>
            </el-dialog>
            <div v-show="activeIndex=='7'" class="con">

                <el-button @click="addVip()">新增VIP</el-button>
                <el-table
                        :data="vipData"
                        border
                        style="width: 100%">
                    <el-table-column
                            prop="id"
                            label="">
                    </el-table-column>
                    <el-table-column
                            prop="name"
                            label="持卡人">
                    </el-table-column>
                    <el-table-column
                            prop="surplus"
                            label="余额">
                    </el-table-column>
                    <el-table-column
                            prop="user_id"
                            label="用户，可用于注册，转让">
                    </el-table-column>
                    <el-table-column
                            prop="staus"
                            label="卡状态(0默认1已退卡)">
                    </el-table-column>
                    <el-table-column
                            prop="create_time"
                            label="建立时间">
                    </el-table-column>
                    <el-table-column
                            prop="update_time"
                            label="更新时间">
                    </el-table-column>
                    <el-table-column
                            prop="phone"
                            label="会员手机号">
                    </el-table-column>
                    <el-table-column
                            fixed="right"
                            label="操作"
                            width="100">
                        <template slot-scope="scope" width="100">
                            <el-button ref="editVip" type="text" size="small" @click="editVip(scope.row)">编辑</el-button>
                            <el-button ref="delVip" type="text" size="small" @click="delVip(scope.row)">删除</el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <div style="text-align:right;">
                    <el-pagination
                            @current-change="handleVipCurrentChange"
                            :current-page="pageVipInit.currentPage"
                            :page-size="10"
                            layout="total, prev, pager, next, jumper"
                            :total="pageVipInit.totalResult">
                    </el-pagination>
                </div>
            </div><!--新增VIP-->

            <!--            评语模板管理-->
            <div v-show="activeIndex=='9'" class="con">

                <el-table
                        :data="operationFlowData"
                        border
                        style="width: 100%">
                    <el-table-column
                            prop="id"
                            label="id">
                    </el-table-column>
                    <el-table-column
                            prop="type"
                            label="成绩等级">
                    </el-table-column>
                    <el-table-column
                            prop="comment"
                            label="评论">
                    </el-table-column>

                    <el-table-column
                            fixed="right"
                            label="操作"
                            width="100">
                        <template slot-scope="scope" width="100">
                            <el-button ref="editVip" type="text" size="small" @click="editCommentConfig(scope.row)">编辑
                            </el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <div style="text-align:right;">
                    <el-pagination
                            @current-change="handleVipCurrentChange"
                            :current-page="pageVipInit.currentPage"
                            :page-size="10"
                            layout="total, prev, pager, next, jumper"
                            :total="pageVipInit.totalResult">
                    </el-pagination>
                </div>
            </div>
            <el-dialog
                    title="评语模板编辑"
                    :visible.sync="commentConfigFlag"
                    width="50%">
                <el-form ref="vipForm" :model="commentConfigForm" label-width="80px">

                    <el-form-item label="id">
                        <el-input :disabled="true" v-model="commentConfigForm.id"></el-input>
                    </el-form-item>

                    <el-form-item label="分类">
                        <el-input :disabled="true" v-model="commentConfigForm.type"></el-input>
                    </el-form-item>

                    <el-form-item label="评语">
                        <el-input type="textarea"
                                  :rows="2"
                                  placeholder="请输入内容"
                                  v-model="commentConfigForm.comment"></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" @click="updateCommentConfig">立即提交</el-button>
                    </el-form-item>
                </el-form>
            </el-dialog>
            <!--            假期通知册 -->
            <div v-show="activeIndex=='10'" class="con">
                <el-row>
                    <el-col :span="3">


                        <el-table
                                :data="studentlist"
                                border
                                style="color: white;border: 1px solid greenyellow;border-radius: 10px">

                            <el-table-column
                                    fixed="right"
                                    label="学生名称"
                                    width="100"
                                    style="border-bottom: 1px solid gray">
                                <template slot-scope="scope" width="100">
                                    <el-button ref="editVip" type="text" size="small" @click="selectStudent(scope.row)">
                                        {{scope.row.name}}
                                    </el-button>
                                </template>
                            </el-table-column>
                        </el-table>
                    </el-col>
                    <el-col :span="17" :offset="1">
                        <div style="min-height: 500px">
                            <div v-show="notify_turnPage== 0" @click="notify_turnPage=1">
                                <img  style="z-index: -1" src="static/img/page1.jpg">
                                <div style=" margin-left : 100px;margin-top: -200px;font-size: 20px;color: dimgray">
                                    <span>姓名：{{selected_notify_student.name}}</span>
                                    <span>班级：{{selected_notify_student.grade}}</span>
                                    <div>

                                        <span>德：{{selected_notify_student.s_de}}</span>
                                        <span>智：{{selected_notify_student.s_zhi}}</span>
                                        <span>体：{{selected_notify_student.s_ti}}</span>
                                        <span>美：{{selected_notify_student.s_mei}}</span>
                                        <span>劳：{{selected_notify_student.s_nao}}</span>
                                    </div>
                                </div>
                            </div>
                            <div v-show="notify_turnPage== 1" @click="notify_turnPage=0">
                                <img src="static/img/page3.jpg">
                                <div style=" margin-left : 80px;margin-top: -750px;font-size: 20px;color: dimgray">
                                    {{homework.info}}
                                </div>
                            </div>

                        </div>
                    </el-col>
                </el-row>
            </div>

            <div v-show="activeIndex=='11'" class="con">
                <el-form ref="vipForm" :model="homework" label-width="80px">

                    <el-form-item label="作业">
                        <el-input
                                type="textarea"
                                :rows="10"
                                placeholder="请输入内容"
                                v-model="homework.info"></el-input>
                    </el-form-item>
                    <el-form-item label="操作">
                        <el-button type="success" @click="savehomework">保存</el-button>
                    </el-form-item>

                </el-form>
            </div>
        </div>
    </div>
</div>

</body><!-- 全局js -->
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
<script>
    var basePath = "/" + window.location.pathname.split("/")[1];
    var indexApp = new Vue({
        el: "#indexApp",
        data() {
            return {
                basePathUpdate: `${basePath}/upload`,
                activeIndex: '1',
                userObj: {},
                treeList: [],
                props: {
                    label: 'type_name',
                    children: 'children',
                    isLeaf: 'leaf'
                },
                courseOptions: [],
                appUserData: [],
                pageAppUserInit: {totalResult: 10, currentPage: 1},
                appUserForm: {},
                commentConfigForm: {},
                addAppUserType: 'addAppUser',
                appUserTitle: '新增学生',
                appUserFlag: false,
                loading: false,
                chainStoreData: [],
                pageChainStoreInit: {totalResult: 10, currentPage: 1},
                chainStoreForm: {},
                addChainStoreType: 'addChainStore',
                chainStoreTitle: '新增课程',
                chainStoreFlag: false,
                operationFlowData: [],
                pageOperationFlowInit: {totalResult: 10, currentPage: 1},
                operationFlowForm: {},
                addOperationFlowType: 'addOperationFlow',
                operationFlowTitle: '新增营业流水',
                operationFlowFlag: false,
                posData: [],
                pagePosInit: {totalResult: 10, currentPage: 1},
                posForm: {},
                addPosType: 'addPos',
                posTitle: '新增商户',
                posFlag: false,
                notify_turnPage: 0,
                roleData: [],
                pageRoleInit: {totalResult: 10, currentPage: 1},
                roleForm: {},
                addRoleType: 'addRole',
                roleTitle: '新增角色',
                roleFlag: false,
                systemUserData: [],
                pageSystemUserInit: {totalResult: 10, currentPage: 1},
                systemUserForm: {},
                addSystemUserType: 'addSystemUser',
                systemUserTitle: '新增老师',
                systemUserFlag: false,
                vipData: [],
                pageVipInit: {totalResult: 10, currentPage: 1},
                vipForm: {},
                homework: {},
                studentlist: [],
                selected_notify_student: {},
                addVipType: 'addVip',
                vipTitle: '新增VIP',
                vipFlag: false,
                commentConfigFlag: false,
                uploadUrl: basePath
            }
        },
        created() {
            this.userObj = JSON.parse(localStorage.getItem('userInfo'));
            this.handleAppUserCurrentChange(1);
        },
        mounted() {

        },
        methods: {
            selectStudent(row) {
                this.selected_notify_student = row;
                this.notify_turnPage = 0;
            },
            handleSelect(key, keyPath) {
                console.log(key)
                this.activeIndex = key;
                if (key == '1') {
                    this.handleAppUserCurrentChange(1);
                } else if (key == '2') {
                    this.handleChainStoreCurrentChange(1);
                } else if (key == '3') {
                    this.handleOperationFlowCurrentChange(1);
                } else if (key == '4') {
                    this.handlePosCurrentChange(1);
                } else if (key == '5') {
                    this.handleRoleCurrentChange(1);
                } else if (key == '6') {
                    this.handleSystemUserCurrentChange(1);
                } else if (key == '7') {
                    this.handleVipCurrentChange(1);
                } else if (key == '8') {
                    this.loginOut();
                } else if (key == '9') { // 评语模板管理
                    this.handleCommentConfigPages(1);
                } else if (key == '10') { // 假期通知册
                    this.handleNotifyPage(1);
                } else if (key == '11') { // 假期通知册
                    this.handlehomwork(1);
                }
                this.$forceUpdate();
            },
            handleNotifyPage() {
                console.log("handleNotifyPage")
                let that = this;
                $.ajax({
                    type: "GET",
                    url: `${basePath}/small_student/getAllSmall_studentList`,
                    success: function (data) {
                        that.studentlist = data.rows;
                        if (data.rows.length > 0)
                            that.selected_notify_student = data.rows[0];
                        that.notify_turnPage = 0;
                    }
                })
                $.ajax({
                    type: "GET",
                    url: `${basePath}/comment/getHomeWork`,
                    data: {},
                    success: function (data) {
                        that.homework = data.info;
                    }
                })
            },
            savehomework() {
                let that = this;
                $.ajax({
                    type: "GET",
                    url: `${basePath}/comment/updateHomeWork`,
                    data: this.homework,
                    success: function (data) {
                        that.$message({
                            type: 'success',
                            message: '保存成功！'
                        });
                    }
                })
            },
            handleCommentConfigPages() {
                let that = this;
                console.log("handleCommentConfigPages")
                $.ajax({
                    type: "GET",
                    url: `${basePath}/comments/getAllCommentConfig`,
                    data: {},
                    success: function (data) {
                        that.operationFlowData = data.rows;
                        that.pageOperationFlowInit.totalResult = 4;
                        that.pageOperationFlowInit.currentPage = 1;
                    }
                })
            },
            handlehomwork() {
                let that = this;
                $.ajax({
                    type: "GET",
                    url: `${basePath}/comment/getHomeWork`,
                    data: {},
                    success: function (data) {
                        that.homework = data.info;
                    }
                })
            },
            loginOut() {
                var that = this;
                $.ajax({
                    type: "GET",
                    url: `${basePath}/logout`,
                    data: {},
                    success: function (data) {
                        window.location.href = basePath + "/login";
                    }
                })
            },
            handleAvatarSuccess(response, file, fileList) {
                this.chainStoreForm.url = response.path;
            },
            getProfessionalList(val) {
                let treeData;
                $.ajax({
                    type: "GET",
                    url: `${basePath}/dishes-type/getDishesTypeList`,
                    data: {parent_id: val},
                    async: false,
                    success: function (data) {
                        treeData = data.data;
                    }
                })
                return treeData
            },
            loadNode(node, resolve) {
                if (node.level === 0) {
                    return resolve(this.treeList);
                } else {
                    console.log(node);
                    resolve(this.getProfessionalList(node.data.id))
                }
            },
            treeNode(obj, node, item) {
                console.log(obj);
                this.activeObj = obj;
                this.handleItemCurrentChange(obj.id);
            },
            returnUser(id) {
                let that = this;
                let name = '';
                $.ajax({
                    type: "GET",
                    url: `${basePath}/small_student/getsSmall_studentByColumn`,
                    data: {id},
                    async: false,
                    success: function (data) {
                        if (data.data) {
                            name = data.data.name;
                        }
                    }
                })
                return name
            },
            returnSysUser(id) {
                let that = this;
                let name = '';
                $.ajax({
                    type: "GET",
                    url: `${basePath}/system-user/getSystemUserByColumn`,
                    data: {id},
                    async: false,
                    success: function (data) {
                        if (data.data) {
                            name = data.data.NAME;
                        }
                    }
                })
                return name
            },

            handleAppUserCurrentChange(val) {
                var that = this;
                $.ajax({
                    type: "GET",
                    url: `${basePath}/small_student/getPagesSmall_studentList`,
                    data: {currentPage: val},
                    success: function (data) {
                        that.appUserData = data.rows;
                        that.pageAppUserInit.totalResult = data.total;
                        that.pageAppUserInit.currentPage = val;
                    }
                })
            },
            addAppUser() {
                this.appUserTitle = '新增学生';
                this.appUserForm = {};
                this.appUserFlag = true;
            },
            editAppUser(row) {
                this.appUserTitle = '编辑学生';
                this.appUserForm = row;
                this.appUserFlag = true;
            },
            delAppUser(row) {
                var that = this;
                that.$confirm('确认删除该学生信息！', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    $.ajax({
                        type: "GET",
                        url: `${basePath}/small_student/deletesSmall_student`,
                        data: {id: row.id},
                        success: function (data) {
                            that.handleAppUserCurrentChange(1);
                        }
                    })
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消删除'
                    });
                });
            },
            onAppUserSubmit() {
                var that = this;
                if (this.appUserTitle == '新增学生') {
                    $.ajax({
                        type: "GET",
                        url: `${basePath}/small_student/addsSmall_student`,
                        data: that.appUserForm,
                        success: function (data) {
                            that.appUserTitle = '';
                            that.appUserFlag = false;
                            that.handleAppUserCurrentChange(1);
                        }
                    })
                } else if (this.appUserTitle == '编辑学生') {
                    $.ajax({
                        type: "GET",
                        url: `${basePath}/small_student/updatesSmall_student`,
                        data: that.appUserForm,
                        success: function (data) {
                            that.appUserTitle = '';
                            that.appUserFlag = false;
                            that.handleAppUserCurrentChange(1);
                        }
                    })
                }

            },
            handleChainStoreCurrentChange(val) {
                var that = this;
                $.ajax({
                    type: "GET",
                    url: `${basePath}/comment/getPagesCommentList`,
                    data: {currentPage: val},
                    success: function (data) {
                        that.chainStoreData = data.rows;
                        that.pageChainStoreInit.totalResult = data.total;
                        that.pageChainStoreInit.currentPage = val;
                    }
                })
            },
            addChainStore() {
                this.chainStoreTitle = '新增公告';
                this.chainStoreForm = {};
                this.chainStoreFlag = true;
            },
            editChainStore(row) {
                this.chainStoreTitle = '编辑公告';
                this.chainStoreForm = row;
                this.chainStoreFlag = true;
            },
            delChainStore(row) {
                var that = this;
                that.$confirm('确认删除该公告信息！', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    $.ajax({
                        type: "GET",
                        url: `${basePath}/comment/deletesComment`,
                        data: {id: row.id},
                        success: function (data) {
                            that.handleChainStoreCurrentChange(1);
                        }
                    })
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消删除'
                    });
                });
            },
            onChainStoreSubmit() {
                var that = this;
                if (this.chainStoreTitle == '新增公告') {
                    $.ajax({
                        type: "GET",
                        url: `${basePath}/comment/addsComment`,
                        data: that.chainStoreForm,
                        success: function (data) {
                            that.chainStoreTitle = '';
                            that.chainStoreFlag = false;
                            that.handleChainStoreCurrentChange(1);
                        }
                    })
                } else if (this.chainStoreTitle == '编辑公告') {
                    $.ajax({
                        type: "GET",
                        url: `${basePath}/comment/updatesComment`,
                        data: that.chainStoreForm,
                        success: function (data) {
                            that.chainStoreTitle = '';
                            that.chainStoreFlag = false;
                            that.handleChainStoreCurrentChange(1);
                        }
                    })
                }

            },
            getCourseOptions() {
                let that = this;
                $.ajax({
                    type: "GET",
                    url: `${basePath}/small_student/getsSmall_studentList`,
                    data: {},
                    success: function (data) {
                        that.courseOptions = data.data;
                    }
                })

            },
            handleOperationFlowCurrentChange(val) {
                var that = this;
                $.ajax({
                    type: "GET",
                    url: `${basePath}/comments/getPagesCommentsList`,
                    data: {currentPage: val},
                    success: function (data) {
                        that.operationFlowData = data.rows;
                        that.pageOperationFlowInit.totalResult = data.total;
                        that.pageOperationFlowInit.currentPage = val;
                    }
                })
            },
            handleTestSuccess(res, file) {
                this.operationFlowForm.url = res.path;
            },
            addOperationFlow() {
                this.operationFlowTitle = '新增学生评语';
                this.operationFlowForm = {
                    s_id: this.userObj.id,
                    c_title: this.userObj.NAME
                };
                this.getCourseOptions();
                this.operationFlowFlag = true;
            },
            generateComment() {

                this.loadding = true;
                var that = this;
                $.ajax({
                    type: "GET",
                    url: `${basePath}/comments/generateComment`,
                    data: {},
                    success: function (data) {
                        that.handleOperationFlowCurrentChange(1);
                        console.log(data)
                    }
                })
            },
            editOperationFlow(row) {
                this.operationFlowTitle = '编辑学生评语';
                this.operationFlowForm = row;
                this.getCourseOptions();
                this.operationFlowFlag = true;
            },
            delOperationFlow(row) {
                var that = this;
                that.$confirm('确认删除该学生评语信息！', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    $.ajax({
                        type: "GET",
                        url: `${basePath}/comments/deletesComments`,
                        data: {id: row.id},
                        success: function (data) {
                            that.handleOperationFlowCurrentChange(1);
                        }
                    })
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消删除'
                    });
                });
            },
            onOperationFlowSubmit() {
                var that = this;
                if (this.operationFlowTitle == '新增学生评语') {
                    $.ajax({
                        type: "GET",
                        url: `${basePath}/comments/addsComments`,
                        data: that.operationFlowForm,
                        success: function (data) {
                            that.operationFlowTitle = '';
                            that.operationFlowFlag = false;
                            that.handleOperationFlowCurrentChange(1);
                        }
                    })
                } else if (this.operationFlowTitle == '编辑学生评语') {
                    $.ajax({
                        type: "GET",
                        url: `${basePath}/comments/updatesComments`,
                        data: that.operationFlowForm,
                        success: function (data) {
                            that.operationFlowTitle = '';
                            that.operationFlowFlag = false;
                            that.handleOperationFlowCurrentChange(1);
                        }
                    })
                }

            },
            returnCourse(id) {
                let that = this;
                let courseName = '';
                $.ajax({
                    type: "GET",
                    url: `${basePath}/course/getCourseByColumn`,
                    data: {id},
                    async: false,
                    success: function (data) {
                        courseName = data.data.name;
                    }
                })
                return courseName
            },
            handlePosCurrentChange(val) {
                var that = this;
                $.ajax({
                    type: "GET",
                    url: `${basePath}/stp/getPageStudentTestPaperList`,
                    data: {currentPage: val},
                    success: function (data) {
                        that.posData = data.rows;
                        that.pagePosInit.totalResult = data.total;
                        that.pagePosInit.currentPage = val;
                    }
                })
            },
            addPos() {
                this.posTitle = '新增商户';
                this.posForm = {};
                this.posFlag = true;
            },
            editPos(row) {
                this.posForm = row;
                this.posFlag = true;
            },
            delPos(row) {
                var that = this;
                that.$confirm('确认删除该商户信息！', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    $.ajax({
                        type: "GET",
                        url: `${basePath}/pos/deletePosByColumn`,
                        data: {id: row.id},
                        success: function (data) {
                            that.handlePosCurrentChange(1);
                        }
                    })
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消删除'
                    });
                });
            },
            onPosSubmit() {
                var that = this;
                $.ajax({
                    type: "GET",
                    url: `${basePath}/stp/updateStudentTestPaper`,
                    data: that.posForm,
                    success: function (data) {
                        that.posTitle = '';
                        that.posFlag = false;
                        that.handlePosCurrentChange(1);
                    }
                })
            },
            handleRoleCurrentChange(val) {
                var that = this;
                $.ajax({
                    type: "GET",
                    url: `${basePath}/role/getPageRoleList`,
                    data: {currentPage: val},
                    success: function (data) {
                        that.roleData = data.rows;
                        that.pageRoleInit.totalResult = data.total;
                        that.pageRoleInit.currentPage = val;
                    }
                })
            },
            addRole() {
                this.roleTitle = '新增角色';
                this.roleForm = {};
                this.roleFlag = true;
            },
            editRole(row) {
                this.roleTitle = '编辑角色';
                this.roleForm = row;
                this.roleFlag = true;
            },
            delRole(row) {
                var that = this;
                that.$confirm('确认删除该角色信息！', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    $.ajax({
                        type: "GET",
                        url: `${basePath}/role/deleteRoleByColumn`,
                        data: {id: row.id},
                        success: function (data) {
                            that.handleRoleCurrentChange(1);
                        }
                    })
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消删除'
                    });
                });
            },
            onRoleSubmit() {
                var that = this;
                if (this.roleTitle == '新增角色') {
                    $.ajax({
                        type: "GET",
                        url: `${basePath}/role/addRole`,
                        data: that.roleForm,
                        success: function (data) {
                            that.roleTitle = '';
                            that.roleFlag = false;
                            that.handleRoleCurrentChange(1);
                        }
                    })
                } else if (this.roleTitle == '编辑角色') {
                    $.ajax({
                        type: "GET",
                        url: `${basePath}/role/updateRole`,
                        data: that.roleForm,
                        success: function (data) {
                            that.roleTitle = '';
                            that.roleFlag = false;
                            that.handleRoleCurrentChange(1);
                        }
                    })
                }

            },
            handleSystemUserCurrentChange(val) {
                var that = this;
                $.ajax({
                    type: "GET",
                    url: `${basePath}/system-user/getPageSystemUserList`,
                    data: {currentPage: val},
                    success: function (data) {
                        that.systemUserData = data.rows;
                        that.pageSystemUserInit.totalResult = data.total;
                        that.pageSystemUserInit.currentPage = val;
                    }
                })
            },
            addSystemUser() {
                this.systemUserTitle = '新增老师';
                this.systemUserForm = {role_id: 2};
                this.systemUserFlag = true;
            },
            editSystemUser(row) {
                this.systemUserTitle = '编辑老师';
                this.systemUserForm = row;
                this.systemUserFlag = true;
            },
            delSystemUser(row) {
                var that = this;
                that.$confirm('确认删除该老师信息！', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    $.ajax({
                        type: "GET",
                        url: `${basePath}/system-user/deleteSystemUser`,
                        data: {id: row.id},
                        success: function (data) {
                            that.handleSystemUserCurrentChange(1);
                        }
                    })
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消删除'
                    });
                });
            },
            onSystemUserSubmit() {
                var that = this;
                if (this.systemUserTitle == '新增老师') {
                    $.ajax({
                        type: "GET",
                        url: `${basePath}/system-user/addSystemUser`,
                        data: that.systemUserForm,
                        success: function (data) {
                            that.systemUserTitle = '';
                            that.systemUserFlag = false;
                            that.handleSystemUserCurrentChange(1);
                        }
                    })
                } else if (this.systemUserTitle == '编辑老师') {
                    $.ajax({
                        type: "GET",
                        url: `${basePath}/system-user/updateSystemUser`,
                        data: that.systemUserForm,
                        success: function (data) {
                            that.systemUserTitle = '';
                            that.systemUserFlag = false;
                            that.handleSystemUserCurrentChange(1);
                        }
                    })
                }

            },
            handleVipCurrentChange(val) {
                var that = this;
                $.ajax({
                    type: "GET",
                    url: `${basePath}/vip/getPageVipList`,
                    data: {currentPage: val},
                    success: function (data) {
                        that.vipData = data.rows;
                        that.pageVipInit.totalResult = data.total;
                        that.pageVipInit.currentPage = val;
                    }
                })
            },
            updateCommentConfig() {
                var that = this;
                $.ajax({
                    type: "GET",
                    url: `${basePath}/comments/updateCommentConfig`,
                    data: that.commentConfigForm,
                    success: function (data) {
                        that.commentConfigFlag = false;
                        // that.vipData = data.rows;
                        // that.pageVipInit.totalResult = data.total;
                        // that.pageVipInit.currentPage = val;
                    }
                })
            },
            addVip() {
                this.vipTitle = '新增VIP';
                this.vipForm = {};
                this.vipFlag = true;
            },
            editVip(row) {
                this.vipTitle = '编辑VIP';
                this.vipForm = row;
                this.vipFlag = true;
            },
            editCommentConfig(row) {
                this.commentConfigTitle = '编辑模板';
                this.commentConfigForm = row;
                this.commentConfigFlag = true;
            },
            delVip(row) {
                var that = this;
                that.$confirm('确认删除该VIP信息！', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    $.ajax({
                        type: "GET",
                        url: `${basePath}/vip/deleteVipByColumn`,
                        data: {id: row.id},
                        success: function (data) {
                            that.handleVipCurrentChange(1);
                        }
                    })
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消删除'
                    });
                });
            },
            onVipSubmit() {
                var that = this;
                if (this.vipTitle == '新增VIP') {
                    $.ajax({
                        type: "GET",
                        url: `${basePath}/vip/addVip`,
                        data: that.vipForm,
                        success: function (data) {
                            that.vipTitle = '';
                            that.vipFlag = false;
                            that.handleVipCurrentChange(1);
                        }
                    })
                } else if (this.vipTitle == '编辑VIP') {
                    $.ajax({
                        type: "GET",
                        url: `${basePath}/vip/updateVip`,
                        data: that.vipForm,
                        success: function (data) {
                            that.vipTitle = '';
                            that.vipFlag = false;
                            that.handleVipCurrentChange(1);
                        }
                    })
                }

            }
        }
    })

</script>
</html>
